package com.viphuli.http.handler;

import android.os.Bundle;

import com.offroader.utils.ViewUtils;
import com.viphuli.app.R;
import com.viphuli.common.Constants.UserType;
import com.viphuli.common.MyPageHelper;
import com.viphuli.fragment.AccountNurseJoinReadyFragment;
import com.viphuli.http.bean.page.AccountPage;
import com.viphuli.http.bean.part.AccountUser;

public class AccountNurseJoinReadyResponseHandler extends MyBaseHttpResponseHandler<AccountNurseJoinReadyFragment, AccountPage> {
	
	@Override
	public void deal() {
		
		AccountPage accountPage = (AccountPage) page;
		AccountUser user = accountPage.getUser();

		if (user != null) {

			if (user.getUserType() == UserType.nurse.getValue()) {//护士提示等待审核

				ViewUtils.toast("您已申请加入，请等待审核");

			} else {//跳转加入护士资料提交，并关闭当前界面

				Bundle args = new Bundle();
				if (user != null)
					args.putString("phone", user.getTel());

				MyPageHelper.accountNurseJoin.showMyPage(caller.getActivity(), args);
				caller.getActivity().finish();

			}

		} else {
			ViewUtils.toast(R.string.tip_user_info_empty);
		}
		
	}
	
}
